/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Cristian
 */
@Entity
@Table(name = "scactbnivel")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Scactbnivel.findAll", query = "SELECT s FROM Scactbnivel s"),
    @NamedQuery(name = "Scactbnivel.findByScactbnivelid", query = "SELECT s FROM Scactbnivel s WHERE s.scactbnivelid = :scactbnivelid"),
    @NamedQuery(name = "Scactbnivel.findByNombre", query = "SELECT s FROM Scactbnivel s WHERE s.nombre = :nombre")})
public class Scactbnivel implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "scactbnivelid")
    private Integer scactbnivelid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "nombre")
    private String nombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "scactbnivelid")
    private Collection<Scactbindica> scactbindicaCollection;

    public Scactbnivel() {
    }

    public Scactbnivel(Integer scactbnivelid) {
        this.scactbnivelid = scactbnivelid;
    }

    public Scactbnivel(Integer scactbnivelid, String nombre) {
        this.scactbnivelid = scactbnivelid;
        this.nombre = nombre;
    }

    public Integer getScactbnivelid() {
        return scactbnivelid;
    }

    public void setScactbnivelid(Integer scactbnivelid) {
        this.scactbnivelid = scactbnivelid;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    @XmlTransient
    public Collection<Scactbindica> getScactbindicaCollection() {
        return scactbindicaCollection;
    }

    public void setScactbindicaCollection(Collection<Scactbindica> scactbindicaCollection) {
        this.scactbindicaCollection = scactbindicaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (scactbnivelid != null ? scactbnivelid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Scactbnivel)) {
            return false;
        }
        Scactbnivel other = (Scactbnivel) object;
        if ((this.scactbnivelid == null && other.scactbnivelid != null) || (this.scactbnivelid != null && !this.scactbnivelid.equals(other.scactbnivelid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entities.Scactbnivel[ scactbnivelid=" + scactbnivelid + " ]";
    }
    
}
